import { xiuShuLiHun } from '../../../api/user'

Page({
  data: {
    scrollViewHeight: 0,
    name: '',
    content: ''
  },

  onLoad: function (options) {
    const _this = this
    wx.getSystemInfo({
      success: function(res) {
        _this.setData({
          scrollViewHeight: res.windowHeight
        })
      }
    });
    this.init()
  },

  onShow() {

  },

  init() {
    xiuShuLiHun().then(res => {
      this.setData({
        name: res.name || wx.getStorageSync('userNickName'),
        content: res.motto
      })
    })
  },

  back() {
    wx.navigateBack({
      delta: 1
    });
  },

  toPageMessage() {
    wx.navigateTo({ url: '/packageA/pages/message/message' })
  },

  editMotto() {
    wx.navigateTo({
      url: '/packageA/pages/editMotto/editMotto?content=' + this.data.content
    })
  }
})
